package com.bjesc_b2c.app.appraiset.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.bjesc_b2c.app.appraiset.R;

import java.util.List;

import app.pinggushi.bjesc.com.baserecyclerview.adapter.CommonAdapter;
import app.pinggushi.bjesc.com.baserecyclerview.adapter.base.ViewHolder;
import master_bean.ToDayBean;

/**
 * Created by lenovo on 2017/4/26.
 */

public class RepulseAdapter extends CommonAdapter<ToDayBean> {


    public RepulseAdapter(Context context, int layoutId, List<ToDayBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convertView(ViewHolder holder, ToDayBean o, int position) {
        String statusType = o.getStatus_type(); //检测状态
        if (!TextUtils.isEmpty(o.getExamines_time())) {
            holder.setText(R.id.tv_appointment_time  ,
                    "提交检测时间: " + o.getExamines_time());
        }
        if (!TextUtils.isEmpty(o.getCases())) {
            holder.setText(R.id.tv_appointment_case, "审核失败原因: " + o.getCases());
        }
        if (!TextUtils.isEmpty(o.getBrand_name())) {
            holder.setText(R.id.tv_car_brand, o.getBrand_name());               //设置车品牌
            if (!TextUtils.isEmpty(o.getSeries_name())) {
                holder.setText(R.id.tv_car_brand, o.getBrand_name()+"-"+o.getSeries_name());               //设置车品牌
            }
        }
        if (!TextUtils.isEmpty(o.getCar_id())) {
            holder.setText(R.id.tv_car_id, "车源ID：" + o.getCar_id());
        }
        holder.setText(R.id.tv_detection_status, statusType);        //设置检查状态


        if (1 == 1) { //设置动作状态颜色
            //蓝色
            holder.setBackgroundDrawable(R.id.tv_action_status, mContext.getResources().getDrawable(R.drawable.shape_todayplan_item_label_blue));
        } else {
            //绿色
            holder.setBackgroundDrawable(R.id.tv_action_status, mContext.getResources().getDrawable(R.drawable.shape_todayplan_item_label_green));
        }
    }
}